﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if( !IsPostBack){
            foreach (WebPartDisplayMode wpdm in WebPartManager1.SupportedDisplayModes)
            {
                DropDownList1.Items.Add(new ListItem(wpdm.Name, wpdm.Name));                
            }            
        }
    }
   

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        WebPartManager1.DisplayMode = WebPartManager1.SupportedDisplayModes[DropDownList1.SelectedValue];
    }
}
